home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 4.iso / src / exampleCode / GLX / DBglxwidgetOpenGL / GlxDraw.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-08-02  |  6.8 KB  |  212 lines

  1. /*
  2.  *    These files are for informational purposes and can demonstrate how
  3.  *   to write your own mixed-mode GL-based widgets.  However SGI does not
  4.  *   guarantee that this source code absolutely matches the GLxDraw
  5.  *   widget that is shipped as part of the system.
  6.  */
  7.  
  8. /***********************************************************
  9. Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
  10. and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
  11.  
  12.                         All Rights Reserved
  13.  
  14. Permission to use, copy, modify, and distribute this software and its 
  15. documentation for any purpose and without fee is hereby granted, 
  16. provided that the above copyright notice appear in all copies and that
  17. both that copyright notice and this permission notice appear in 
  18. supporting documentation, and that the names of Digital or MIT not be
  19. used in advertising or publicity pertaining to distribution of the
  20. software without specific, written prior permission.  
  21.  
  22. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  23. ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  24. DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  25. ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  26. WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  27. ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  28. SOFTWARE.
  29.  
  30. ******************************************************************/
  31.  
  32. #ifndef _GlxDraw_h
  33. #define _GlxDraw_h
  34.  
  35. #ifdef USE_GL
  36. #include <gl/glws.h>
  37. #else
  38. #include <GL/glx.h>
  39. #endif /* USE_GL */
  40.  
  41. /****************************************************************
  42.  *
  43.  * GlxDraw widgets
  44.  *
  45.  ****************************************************************/
  46.  
  47. /* Resources:
  48.  
  49.  Name             Class        RepType        Default Value
  50.  ----             -----        -------        -------------
  51.  destroyCallback     Callback        Pointer        NULL
  52.  exposeCallback      Callback        Pointer        NULL
  53.  ginitCallback       Callback        Pointer        NULL
  54.  inputCallback       Callback        Pointer        NULL
  55.  resizeCallback      Callback        Pointer        NULL
  56.  
  57.  overlayExposeCallback Callback        Pointer        NULL
  58.  underlayExposeCallback Callback    Pointer        NULL
  59.  popupExposeCallback Callback        Pointer        NULL
  60.  
  61.  glxConfig         GlxConfig        GLXconfig *    {{0,0,0}}
  62.  glxContext         GlxContext        GLXContext      0
  63.  visual             Visual        Visual        NULL
  64.  overrideColormap    OverrideColormap    Boolean        TRUE
  65.  useOverlay         UseOverlay        Boolean        FALSE
  66.  overlayColormap     Colormap        Colormap    NULL
  67.  overlayDepth        Depth        int        0
  68.  overlayVisual       Visual        VisualInfo    NULL
  69.  overlayWindow       Window        Window        0
  70.  overlayContext      GLXContext        GLXContext    0
  71.  overlayGlxConfig    GlxConfig        int *        NULL
  72.  useUnderlay         UseUnderlay    Boolean        FALSE
  73.  underlayColormap    Colormap        Colormap    NULL
  74.  underlayDepth         Depth        int        0
  75.  underlayVisual         Visual        VisualInfo    NULL
  76.  underlayWindow         Window        Window        0
  77.  usePopup         UsePopup        Boolean        FALSE
  78.  popupColormap       Colormap        Colormap    NULL
  79.  popupDepth          Depth        int        0
  80.  popupVisual         Visual        VisualInfo    NULL
  81.  popupWindow         Window        Window        0
  82.  
  83.  provideSingleBuffer ProvideSingleBuffer Boolean    FALSE
  84.  singleBuffer         SingleBuffer    Boolean        ?
  85.  provideStereoBuffer ProvideStereoBuffer Boolean    FALSE
  86.  stereoBuffer         StereoBuffer    Boolean        ?
  87.  altColormap         Colormap        Colormap    NULL
  88.  mainWindow         Window        Window        0
  89. */
  90.  
  91. #define GlxNglxConfig        "glxConfig"
  92. #define GlxCGlxConfig        "GlxConfig"
  93. #define GlxRGlxConfig        "GlxConfig"
  94.  
  95. #ifndef USE_GL
  96. #define GlxNglxContext        "glxContext"
  97. #define GlxCGlxContext        "GlxContext"
  98. #define GlxRGlxContext        "GlxContext"
  99. #endif
  100.  
  101. #define GlxNvisualInfo        "visualInfo"
  102. #define GlxRVisualInfo        "VisualInfo"
  103. #define GlxCVisualInfo        "VisualInfo"
  104.  
  105. #define GlxNoverrideColormap    "overrideColormap"
  106. #define GlxCOverrideColormap    "OverrideColormap"
  107.  
  108. #define GlxCCallback         "Callback"
  109. #define GlxNexposeCallback     "exposeCallback"
  110. #define GlxNginitCallback     "ginitCallback"
  111. #define GlxNresizeCallback     "resizeCallback"
  112. #define GlxNinputCallback     "inputCallback"
  113.  
  114. #define GlxCColormap        "Colormap"
  115. #define GlxCDepth        "Depth"
  116. #define GlxCWindow        "Window"
  117.  
  118. #define GlxNuseOverlay        "useOverlay"
  119. #define GlxCUseOverlay        "UseOverlay"
  120. #define GlxNoverlayColormap    "overlayColormap"
  121. #define GlxNoverlayDepth    "overlayDepth"
  122. #define GlxNoverlayVisual    "overlayVisual"
  123. #define GlxNoverlayWindow    "overlayWindow"
  124. #ifndef USE_GL
  125. #define GlxNoverlayGlxContext    "overlayGlxContext"
  126. #define GlxNoverlayGlxConfig    "overlyGlxConfig"
  127. #endif
  128. #define GlxNoverlayExposeCallback    "overlayExposeCallback"
  129. #define GlxNuseUnderlay        "useUnderlay"
  130. #define GlxCUseUnderlay        "UseUnderlay"
  131. #define GlxNunderlayColormap    "underlayColormap"
  132. #define GlxNunderlayDepth    "underlayDepth"
  133. #define GlxNunderlayVisual    "underlayVisual"
  134. #define GlxNunderlayWindow    "underlayWindow"
  135. #define GlxNunderlayExposeCallback    "underlayExposeCallback"
  136. #define GlxNusePopup        "usePopup"
  137. #define GlxCUsePopup        "UsePopup"
  138. #define GlxNpopupColormap    "popupColormap"
  139. #define GlxNpopupDepth        "popupDepth"
  140. #define GlxNpopupVisual        "popupVisual"
  141. #define GlxNpopupWindow        "popupWindow"
  142. #define GlxNpopupExposeCallback    "popupExposeCallback"
  143.  
  144. #define GlxNprovideSingleBuffer    "provideSingleBuffer"
  145. #define GlxCProvideSingleBuffer    "ProvideSingleBuffer"
  146. #define GlxNsingleBuffer    "singleBuffer"
  147. #define GlxCSingleBuffer    "SingleBuffer"
  148. #define GlxNprovideStereoBuffer    "provideStereoBuffer"
  149. #define GlxCProvideStereoBuffer    "ProvideStereoBuffer"
  150. #define GlxNstereoBuffer    "stereoBuffer"
  151. #define GlxCStereoBuffer    "StereoBuffer"
  152. #define GlxNaltColormap        "altColormap"
  153. #define GlxNmainWindow        "mainWindow"
  154.  
  155. #ifdef __GLX_MOTIF
  156. typedef struct _GlxMDrawClassRec    *GlxMDrawWidgetClass;
  157. typedef struct _GlxMDrawRec        *GlxMDrawWidget;
  158.  
  159. extern WidgetClass glxMDrawWidgetClass;
  160. #else /* not __GLX_MOTIF */
  161. typedef struct _GlxDrawClassRec        *GlxDrawWidgetClass;
  162. typedef struct _GlxDrawRec        *GlxDrawWidget;
  163.  
  164. extern WidgetClass glxDrawWidgetClass;
  165. #endif
  166.  
  167. /* Callback reasons */
  168. #ifdef __GLX_MOTIF
  169. #define GlxCR_EXPOSE    XmCR_EXPOSE
  170. #define GlxCR_RESIZE    XmCR_RESIZE
  171. #define GlxCR_INPUT    XmCR_INPUT
  172. #else /* not __GLX_MOTIF */
  173. /* The same values as Motif, but don't use Motif constants */
  174. #define GlxCR_EXPOSE    38
  175. #define GlxCR_RESIZE    39
  176. #define GlxCR_INPUT    40
  177. #endif /* __GLX_MOTIF */
  178.  
  179. #define GlxCR_GINIT    32135    /* Arbitrary number that should neverr clash*/
  180.  
  181. typedef struct
  182. {
  183.     int     reason;
  184.     XEvent  *event;
  185.     Window  window;
  186.     int     buffer;
  187.     Dimension width, height;        /* for resize callback */
  188. #ifndef USE_GL
  189.     GLXContext context;
  190. #endif
  191. } GlxDrawCallbackStruct;
  192.  
  193.  
  194. #ifdef __GLX_MOTIF
  195. #ifdef _NO_PROTO
  196. extern Widget GlxCreateMDraw ();
  197. #else /* _NO_PROTO */
  198.  
  199. #if defined(__cplusplus) || defined(c_plusplus)
  200. extern "C" {
  201. #endif
  202.  
  203. extern Widget GlxCreateMDraw (Widget parent, char *name, ArgList arglist, Cardinal argcount);
  204. #endif /* _NO_PROTO */
  205.  
  206. #if defined(__cplusplus) || defined(c_plusplus)
  207. }
  208. #endif
  209. #endif /* __GLX_MOTIF */
  210.  
  211. #endif /* _GlxDraw_h */
  212.